package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class MainActivity extends BaseActivity {
    @BindView(R.id.lv)
    ListView lv;
    ArrayAdapter adapter;
    String[] listItems = {"菜单类", "文本类", "图像类",
            "列表类", "进度条", "Tab导航",
            "RecyclerView" ,"Web","开关类",
            "特效类", "图表类"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item,listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Intent intent = null;
        switch (arg2) {
            case 0:
                intent = new Intent(MainActivity.this, MenuActivity.class);
                break;
            case 1:
                intent = new Intent(MainActivity.this, TextActivity.class);
                break;
            case 2:
                intent = new Intent(MainActivity.this, ImageActivity.class);
                break;
            case 3:
                intent = new Intent(MainActivity.this, ListActivity.class);
                break;
            case 4:
                intent = new Intent(MainActivity.this, ProgressActivity.class);
                break;
            case 5:
                intent = new Intent(MainActivity.this, TabActivity.class);
                break;
            case 6:
                intent = new Intent(MainActivity.this, RecyclerViewActivity.class);
                break;
            case 8:
                intent = new Intent(MainActivity.this, SwitchActivity.class);
                break;
            case 9:
                intent = new Intent(MainActivity.this, EffectsActivity.class);
                break;
            case 10:
                intent = new Intent(MainActivity.this, ChartActivity.class);
                break;
        }
        startActivity(intent);
    }

    @Override
    public boolean setLeftVisiable() {
        return false;
    }
}
